package sliver.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import sliver.dao.AdvertiserDao;
import sliver.dao.ShopperDao;
import sliver.entity.Advertiser;
import sliver.entity.Shopper;
import sliver.service.AdvertiserAccountManager;
import sliver.service.ShopperAccountManager;

@Service
@Transactional
public class AccountManagerImpl implements AdvertiserAccountManager, ShopperAccountManager{

	@Autowired
	private AdvertiserDao advertiserDao;
	
	@Autowired
	private ShopperDao shopperDao;
	
	/* AdvertiserAccountManager.java */
	
	@Override
	public Advertiser advertiserLogin(String username, String password) {
		
		Advertiser advertiser = advertiserDao.findByAuth(username, password);
		
		return advertiser;
	}

	/* ShopperAccountManager.java */
	
	@Override
	public Shopper shopperLogin(String username, String password) {
		
		Shopper shopper = shopperDao.findByAuth(username, password);
		
		return shopper;
	}
}
